package com.ruoyi.baoming.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.baoming.domain.TbZsbExamRegistration;
import com.ruoyi.baoming.service.ITbZsbExamRegistrationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 专升本考试报名Controller
 * 
 * @author xiaosong
 * @date 2025-03-10
 */
@Api(tags = "专升本-考试报名管理")
@RestController
@RequestMapping("/baoming/TBregistration")
public class TbZsbExamRegistrationController extends BaseController
{
    @Autowired
    private ITbZsbExamRegistrationService tbZsbExamRegistrationService;

    /**
     * 查询专升本考试报名列表
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:list')")
    @GetMapping("/list")
        @ApiOperation("专升本考试报名管理 - 分页查询列表")
    public TableDataInfo list(TbZsbExamRegistration tbZsbExamRegistration)
    {
        startPage();
        List<TbZsbExamRegistration> list = tbZsbExamRegistrationService.selectTbZsbExamRegistrationList(tbZsbExamRegistration);
        return getDataTable(list);
    }

    /**
     * 导出专升本考试报名列表
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:export')")
    @Log(title = "专升本考试报名", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
        @ApiOperation("专升本考试报名管理 - 导出数据")
    public void export(HttpServletResponse response, TbZsbExamRegistration tbZsbExamRegistration)
    {
        List<TbZsbExamRegistration> list = tbZsbExamRegistrationService.selectTbZsbExamRegistrationList(tbZsbExamRegistration);
        ExcelUtil<TbZsbExamRegistration> util = new ExcelUtil<TbZsbExamRegistration>(TbZsbExamRegistration.class);
        util.exportExcel(response, list, "专升本考试报名数据");
    }

    /**
     * 获取专升本考试报名详细信息
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:query')")
    @GetMapping(value = "/{id}")
        @ApiOperation("专升本考试报名管理 - 根据ID获取详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbZsbExamRegistrationService.selectTbZsbExamRegistrationById(id));
    }

    /**
     * 新增专升本考试报名
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:add')")
    @Log(title = "专升本考试报名", businessType = BusinessType.INSERT)
    @PostMapping
        @ApiOperation("专升本考试报名管理 - 新增数据")
    public AjaxResult add(@RequestBody TbZsbExamRegistration tbZsbExamRegistration)
    {
        return toAjax(tbZsbExamRegistrationService.insertTbZsbExamRegistration(tbZsbExamRegistration));
    }

    /**
     * 修改专升本考试报名
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:edit')")
    @Log(title = "专升本考试报名", businessType = BusinessType.UPDATE)
    @PutMapping
        @ApiOperation("专升本考试报名管理 - 修改数据")
    public AjaxResult edit(@RequestBody TbZsbExamRegistration tbZsbExamRegistration)
    {
        return toAjax(tbZsbExamRegistrationService.updateTbZsbExamRegistration(tbZsbExamRegistration));
    }

    /**
     * 删除专升本考试报名
     */
    @PreAuthorize("@ss.hasPermi('baoming:TBregistration:remove')")
    @Log(title = "专升本考试报名", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
        @ApiOperation("专升本考试报名管理 - 删除数据")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbZsbExamRegistrationService.deleteTbZsbExamRegistrationByIds(ids));
    }
}
